﻿Imports System.Data.OleDb

Public Class ArtVideoList
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.Params("ArtistId") = "" Then Response.Redirect("Artists.aspx") 'if no params in ID, then back to start
        'create a data reader field
        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("3dBuzzDatabase").ConnectionString)
        Dim SqlString As String = "SELECT Video.[VideoId], Video.[Showreel], Video.[OriginalFilename], Video.[ArtistId], Video.[Title], Artists.[Nickname] FROM Artists INNER JOIN [Video] ON Artists.[ID] = Video.[ArtistId] WHERE (Video.[ArtistId] = @f1)"
        Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@f1", Request.Params("ArtistId"))
        oleDbConn.Open()
        'this is the data reader
        Dim dataReader = cmd.ExecuteReader()    'because we are returning results
        GridView1.DataSource = dataReader
        GridView1.DataBind()


        Dim SqlString2 As String = "SELECT [Nickname] FROM [Artists] WHERE [ID]= @f2"
        Dim cmd2 As OleDbCommand = New OleDbCommand(SqlString2, oleDbConn)
        cmd2.CommandType = CommandType.Text
        cmd2.Parameters.AddWithValue("@f2", Request.Params("ArtistId"))
        Dim dataReader2 = cmd2.ExecuteReader()
        'this is the data reader

        GridView2.DataSource = dataReader2
        GridView2.DataBind()


        'tb_ArtistNickname.Text = dataReader2("Nickname").ToString()


 

    End Sub

End Class